#ifndef _POINT_H
#define _POINT_H

#include <utility>

typedef std::pair<int, int> Point; // reprezinta un punct in plan

// compara doua puncte si returneaza diferit de 0 daca sunt egale
bool operator==(const Point &p1, const Point &p2);

// returneaza un nou punct bazat pe punctul curent si directie
inline Point point_next(const Point &p, unsigned char dir)
{
	Point result;

	switch (dir)
	{
	case 0:
		result.first  = p.first  + 1;
		result.second = p.second;
		break;
	case 1:
		result.first  = p.first  + 1;
		result.second = p.second + 1;
		break;
	case 2:
		result.first  = p.first;
		result.second = p.second + 1;
		break;
	case 3:
		result.first  = p.first  - 1;
		result.second = p.second + 1;
		break;
	case 4:
		result.first  = p.first  - 1;
		result.second = p.second;
		break;
	case 5:
		result.first  = p.first  - 1;
		result.second = p.second - 1;
		break;
	case 6:
		result.first  = p.first;
		result.second = p.second - 1;
		break;
	case 7:
		result.first  = p.first  + 1;
		result.second = p.second - 1;
		break;
	}

	return result;
}

#endif // _POINT_H